Skip to content

RFP-004: DEX ecosystem behaviour appendix and vault accounting recommendation#41

Open
fryorcraken wants to merge 6 commits intomasterfrom
rfp/dex-vault-accounting-appendix
Open

RFP-004: DEX ecosystem behaviour appendix and vault accounting recommendation#41
fryorcraken wants to merge 6 commits intomasterfrom
rfp/dex-vault-accounting-appendix

Conversation

@fryorcraken
Copy link
Copy Markdown
Collaborator

Summary

  • Add appendix/dex-ecosystem-behaviour.md surveying how 7 production DEX protocols (Uniswap V2/V4, Balancer V3, Curve StableSwapNG, CoW Protocol, Raydium, Orca) implement behaviours required by RFP-004
  • Add requirement F.9 to RFP-004: sync() (permissionless) and recoverSurplus(to) (restricted to zero-liquidity pools)
  • Research source: marclawclaw/research-dex

Test plan

  • Review appendix sections 1-9 for accuracy against research vault
  • Review section 10 recommendation with implementor
  • Confirm F.9 wording aligns with implementation

🤖 Generated with Claude Code

fryorcraken and others added 4 commits April 28, 2026 12:08
Add appendix documenting how existing DEX protocols implement
behaviours required by RFP-004: constant-product AMM, immutable fee
tiers, slippage protection, fee distribution, pool creation, single
transaction operations, pool analytics, ATA usage, and vault
accounting patterns.

Recommend implementing sync() (permissionless) and recoverSurplus()
(restricted to zero-liquidity pools) based on ecosystem analysis.
Add requirement F.9 to RFP-004 referencing the appendix.

Research source: github.com/marclawclaw/research-dex

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove recoverSurplus() recommendation. F.9 now requires only
  permissionless sync(); appendix section 10 describes ecosystem
  practice (Uniswap V2 sync/skim, V4/Balancer/Curve alternatives)
  without prescribing LEZ behaviour.
- Reframe F.8: the DEX program must be compatible with ATAs but
  must not force them. Pool vaults may use PDAs (matching Raydium
  and Orca); user-side accepts any valid SPL token account owned
  by the caller.
- Restructure appendix to describe what ecosystem DEXes do, not
  what LEZ should do. Recommendations belong in the RFP body.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Refresh Protocols Considered table from DeFiLlama (snapshot
  2026-04-27): V2 ~$970M, V4 ~$720M (~16 chains, was >$1B/17),
  Balancer V3 ~$80M post 2025-11 V2 exploit, Curve ~$1.7B,
  Raydium ~$1.0B, Orca ~$255M. Replace unsourced ">$300B" Orca
  cumulative with "$36B+ all-time" from Orca's own dashboards.
- Soften "over 100 forks" of V2 to a sourced characterisation.
- Clarify V2 protocol fee: UNIfication passed 2025-12-26; LPs
  receive 0.25%, protocol takes 0.05% (1/6 of 0.3%).
- Replace "98% gas reduction" round-number claim with the
  underlying TSTORE-vs-SSTORE gas costs (100 vs 20,000) per
  EIP-1153.
- Tighten section-10 table: V4 has `PoolManager.sync()` for
  flash-accounting balance checkpointing (not reserve
  reconciliation); previous wording read as "no sync at all".

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brings RFP-004 in line with RFP-000-template.md and the structure
established by RFP-008:

- Usability: add CLI requirement (template item 3); reorder so SDK,
  mini-app, CLI, IDL come first as standard items, RFP-specific items
  follow.
- Supportability: split CI/test items, add doc packets for SDK and
  CLI, add Figma designs requirement.
- Add Soft Requirements section with multi-hop routing,
  recoverSurplus() (moved from F.9 to a soft requirement), and
  compute-unit benchmarking.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@fryorcraken fryorcraken force-pushed the rfp/dex-vault-accounting-appendix branch from 6c7458f to 7ba1e5e Compare April 28, 2026 02:11
fryorcraken and others added 2 commits April 28, 2026 12:18
Remove the soft requirement and add an Out of Scope note. Among
surveyed protocols only Uniswap V2 implements a skim()-style
instruction; Uniswap V4, Balancer V3, Curve StableSwapNG, Raydium,
and Orca Whirlpools do not. Surplus reconciliation is handled
exclusively by the permissionless sync().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The template lists compute-unit documentation as a hard Performance
requirement. Consolidate it with the existing transaction-size
documentation requirement and drop the redundant soft item.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant